package context.render.shader;

import java.util.HashMap;

public class LoadShader
{
    
    private HashMap<String, ShaderVert> mMapVert;
    
    private HashMap<String, ShaderFrag> mMapFrag;
    
    
    public LoadShader()
    {
        this.mMapVert = new HashMap<>();
        this.mMapFrag = new HashMap<>();
    }
    
    
    public void unloadVert(String aFileName)
    {
        this.mMapVert.remove(aFileName);
    }
    
    public void unloadFrag(String aFileName)
    {
        this.mMapFrag.remove(aFileName);
    }
    
    
    public ShaderVert loadVert(String aFileName)
    {
        ShaderVert vert = this.mMapVert.get(aFileName);
        if (vert == null)
        {
            vert = new ShaderVert(aFileName);
            this.mMapVert.put(aFileName, vert);
        }
        return vert;
    }
    
    public ShaderFrag loadFrag(String aFileName)
    {
        ShaderFrag frag = this.mMapFrag.get(aFileName);
        if (frag == null)
        {
            frag = new ShaderFrag(aFileName);
            this.mMapFrag.put(aFileName, frag);
        }
        return frag;
    }
    
}
